package com.lzc.springboot.service.impl;

import com.lzc.springboot.domain.Farmer;
import com.lzc.springboot.mapper.FarmerMapper;
import com.lzc.springboot.service.FarmerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FarmerServiceImpl implements FarmerService {

  @Autowired
  private FarmerMapper farmerMapper;

  @Override
  public Farmer findFarmerByUid(int uid) {
    return farmerMapper.findFarmerByUid(uid);
  }

  @Override
  public void changeFarmer(Farmer farmer) {
    farmerMapper.changeFarmer(farmer);
  }

  @Override
  public Farmer[] findAllFarmer() {
    return farmerMapper.findAllFarmer();
  }

  @Override
  public Farmer[] findFarmerByText(Farmer farmer) {
    return farmerMapper.findFarmerByText(farmer);
  }

  @Override
  public Farmer findFarmerByFid(int fid) {
    return farmerMapper.findFarmerByFid(fid);
  }

  @Override
  public void delFarmerById(int id) {
    farmerMapper.delFarmerById(id);
  }

  @Override
  public void addFarmer(Farmer farmer) {
    farmer.setEmail(farmer.getEmail() + ".com");
    farmerMapper.addFarmer(farmer);
  }
}
